import book.Book;
import book.Booklist;
import user.AdminUser;
import user.NormalUser;
import user.User;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: XMQ
 * Date: 2022-05-18
 * Time: 10:26
 */
/**
 * 图书管理系统的简易实现，只为熟悉语法
 * 不过多考虑业务逻辑
 */
public class Main {

    public static User login(){
        System.out.println("请输入你的名字：");
        Scanner scan = new Scanner(System.in);
        String name = scan.nextLine();
        System.out.println("请输入你的身份1.-》管理员 2.-》普通用户");
        int choice = scan.nextInt();
        if(choice == 1){
            return new AdminUser(name);
        }else{
            return new NormalUser(name);
        }
    }
    public static void main(String[] args) {
        //全部整合到一起
        Booklist booklist = new Booklist();//准备图书
        //登录  user对象引用什么看你选择什么身份
        User user = login();
        while(true){
            int choice = user.menu();
            user.doOperation(choice,booklist);
        }

    }
}
